home *** CD-ROM | disk | FTP | other *** search
/ Freaks Macintosh Archive / Freaks Macintosh Archive.bin / Freaks Macintosh Archives / Hacking & Misc / TR Enet LAP 1.0 Folder.sit / TR Enet LAP 1.0 Folder / TR Enet LAP 1.0 Release Notes < prev    next >
Text File  |  1994-07-23  |  6KB  |  121 lines

  1.  Traceroute Ethernet LAP 1.0
  2.  By: Jim Browne (jbrowne@uiuc.edu)
  3.  7/23/94
  4.  
  5.  I wrote this LAP while on my quest to port the Traceroute program to the Macintosh.
  6.  I 'grew up' on UNIX machines back in the mid-80's, and when I moved over to doing
  7.  TCP/IP programming on the Mac, I really missed Traceroute... so here's the first
  8.  part of it.
  9.  
  10.  What does it do?:
  11.  
  12.  What does this LAP do?  Well, it is (I hope) an exact duplicate of Apple's default
  13.  Ethernet LAP with a few notable exceptions.  First, this LAP implementes loopback
  14.  properly.  (Although it still doesn't do 127.0.0.1, but that can be added if enough
  15.  people complain.)  Second, this LAP installs a Gestalt selector that allows application
  16.  programs to perform Raw IP writes and filter all incoming IP packets.
  17.  
  18.  The Gestalt selector:
  19.  
  20.  The Gestalt selector (JMBe), returns a pointer to the following structure (defined in
  21.  RawIP.h):
  22.  
  23.  typedef struct {
  24.     short        version;                // Version of interface
  25.     short        availFlags;                // What is available
  26.     RawWriteProcPtr        RawIPWrite;        // Raw IP Write routine address
  27.     RawIPFilterProcPtr    RawIPFilter;    // Raw IP Filter routine address
  28.     short        useFilter;                // Non-zero if filter routine is to be called
  29.     Ptr            user1;                    // Passed to Filter routine
  30.     Ptr            user2;                    // Passed to Filter routine
  31.     ProcPtr        reserved1;
  32.     long        reserved2[10];
  33.     } RawIPGestaltStruct;
  34.  
  35. version is the current version of the LAP, in this case 1.
  36.  
  37. availFlags lists what features are available in the LAP.  The two currently defined
  38. flags are kHaveRIPFilter and kHaveRIPWrite.  I did this so I can distribute a version
  39. of the LAP source code that does not have IP filtering in it (more on this later).
  40.  
  41. RawIPWrite is the address of the routine to call inside the LAP to perform a raw IP write.
  42.  
  43. RawIPFilter is a location for you to stick the address of your RawIP filter routine.
  44.  
  45. useFilter tells the LAP whether or not it should call the RawIP filter routine.
  46.  
  47. user1 and user2 are two fields that are passed to the RawIP filter routine you install,
  48. use them as you see fit.
  49.  
  50. How send Raw IP packets:
  51.  
  52. To send a RawIP packet onto the network, allocate a RawWriteParam structure.  Stick your
  53. A5 value in the userA5 field.  Fill out the wdsEntry to point to your IP packet in
  54. memory.  (Be sure to set the length field!).  Finally, you can place the address of
  55. a completion routine in the iop.ioCompletion field.  Then just call the RawWriteIP
  56. function, using the calling conventions typedef'd in RawWriteProcPtr.  It's that easy.
  57. The RawIPWrite function will return an error directly, or in the iop.ioResult field of
  58. the RawWriteParam structure.
  59.  
  60. Those of you who are familliar with the low level routines in MacTCP may recognize the 
  61. RawWriteParam structure as something else in disguise.  Don't let your knowledge fool you!
  62. DO NOT try to use any of the reserved fields in the RawWriteParam structure, it won't
  63. neccessarily do what you would expect.
  64.  
  65. How to filter incoming IP packets:
  66.  
  67. Create a filter function in your application.  The filter function should be of the form
  68. typedef'd as RawIPFilterProcPtr.  The filter function should return true if the LAP should
  69. pass the IP packet onto MacTCP, otherwise the packet will be discarded and MacTCP will
  70. never see it.  The IPdata field points to the incoming IP packet, and the length field
  71. gives you its length.  You may modify the packet data if you wish.  However, changing
  72. the length of the packet will not work.  The filter function will only be called if the
  73. useFilter field in the Gestalt structure is non-zero.  Install your filter _before_ setting
  74. the userFilter field to a non-zero value.  Setting the useFilter field to zero will disable
  75. packet filtering.  I reccomend your application patch ExitToShell to zero the useFilter
  76. field, just in case.
  77.  
  78. So where's Traceroute?:
  79.  
  80. An alpha of traceroute is done.  I'm not at all happy with the interface.  I may work on
  81. it some soon, or I may release it as is, or I may give the code to PeterL so he can do
  82. the interface.  I don't know right now.  The important thing is I am releasing this LAP.
  83. Now anyone can write traceroute for an Ethernet connected Macintosh.
  84.  
  85. What about source code?:
  86.  
  87. I can give out the source code to 90% of the LAP.  The code in there that lets me do 
  88. IP packet filtering, however, is proprietary code owned by someone who shall remain
  89. anonymous.  I'd very much like to that that person for letting me use that little bit
  90. of code.  I can, however, distribute a copy of the source code of the LAP that does not
  91. do IP packet filtering.  Currently I do not have an archive of the non-filtering code
  92. ready, but if you send me some email I will get you a copy.
  93.  
  94. Small print:
  95.  
  96. There is no warranty on this software whatsoever.  It has worked without problems for me
  97. for quite some time.  However, if it crashes your machine or causes you to lose data, I
  98. cannot be held responsible.  I am trying to make it flawless, but I can't state that it
  99. is 100% reliable.
  100.  
  101. Conclusion:
  102.  
  103. I've had the TR Ethernet LAP running on my PowerMacintosh 8100/80 for two months now.  I've
  104. had no problems with it.  This does not, of course, guarantee that it is bug free.  Please
  105. report any bugs you find to me.  I'm very open to suggestions.  I decided at the 
  106. beginning to make this interface open so other people could use it.  I figure if people
  107. have to run a separate LAP to get this functionality, they don't want to have to swtich
  108. between N different LAPs for N different packet filtering applications.
  109.  
  110. If you would like to modify your SLIP or PPP lap to support this interface, please let me
  111. know and I will give you any help I possibly can.  I'd like my traceroute program to work
  112. over SLIP and PPP.
  113.  
  114. Enjoy the LAP, and WRITE FREE SOFTWARE for it. ;)
  115.  
  116. Jim Browne
  117. jbrowne@uiuc.edu
  118. (Occasionally "Zep" on IRC)
  119.  
  120. PS: You see, Klaus, I really do release my code... eventually!
  121.